import pprint
from fastapi import APIRouter

from src.find_kv_and_check_word.datamodel import CheckModel
from src.find_kv_and_check_word.tasks import run_check_task
from src.huey_init.storages import Storage

class Task:
    def __init__(self, id, name=None, status=None):
        self.id = id
        self.name = name
        self.status = status

router = APIRouter(
    prefix="/consistency_check",
    tags=["consistency_check"],
    responses={404: {"description": "Not found"}}
)

@router.post("/check")
async def aicheckfile(check_model: CheckModel):
    
    # res = run_check_task(check_model,task=Task(id=123))
    res = run_check_task(check_model)

    print("返回数据：")
    pprint.pprint(res)

    return {"status": "success", "aitask_id": res.id}